/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ADMINISTRADOR
 */
@Entity
@Table(name = "col_colegiado_deporte")
//@NamedQueries({@NamedQuery(name = "ColegiadoDeporte.findAll", query = "SELECT c FROM ColegiadoDeporte c"), @NamedQuery(name = "ColegiadoDeporte.findByCdeCodigo", query = "SELECT c FROM ColegiadoDeporte c WHERE c.cdeCodigo = :cdeCodigo"), @NamedQuery(name = "ColegiadoDeporte.findByCdeestadoLiga", query = "SELECT c FROM ColegiadoDeporte c WHERE c.cdeestadoLiga = :cdeestadoLiga")})
public class ColegiadoDeporte implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cde_codigo")
    private Long cdeCodigo;       
    @Basic(optional = false)
    @Column(name = "cde_nivel")
    private String cdeNivel;
    @Column(name = "cde_liga")
    private Boolean cdeLiga;
    @Column(name = "cde_sancion")
    private boolean cdeSancion;
    @Basic(optional = false)
    @Column(name = "cde_fechaIniSancion")
    @Temporal(TemporalType.DATE)
    private Date cde_fechaIniSancion;
    @Basic(optional = false)
    @Column(name = "cde_fechaFinSancion")
    @Temporal(TemporalType.DATE)
    private Date cde_fechaFinSancion;


    @JoinColumn(name = "col_codigo", referencedColumnName = "col_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Colegiado colCodigo;
    @JoinColumn(name = "dep_codigo", referencedColumnName = "dep_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Deporte depCodigo;
    

    public ColegiadoDeporte() {
    }

    public ColegiadoDeporte(Long cdeCodigo) {
        this.cdeCodigo = cdeCodigo;
    }

    public Long getCdeCodigo() {
        return cdeCodigo;
    }

    public void setCdeCodigo(Long cdeCodigo) {
        this.cdeCodigo = cdeCodigo;
    }

    public Colegiado getColCodigo() {
        return colCodigo;
    }

    public void setColCodigo(Colegiado colCodigo) {
        this.colCodigo = colCodigo;
    }

    public Deporte getDepCodigo() {
        return depCodigo;
    }

    public void setDepCodigo(Deporte depCodigo) {
        this.depCodigo = depCodigo;
    }

    public String getCdeNivel() {
        return cdeNivel;
    }

    public void setCdeNivel(String cdeNivel) {
        this.cdeNivel = cdeNivel;
    }

    public Boolean getCdeLiga() {
        return cdeLiga;
    }

    public void setCdeLiga(Boolean cdeLiga) {
        this.cdeLiga = cdeLiga;
    }

    public boolean getCdeSancion() {
        return cdeSancion;
    }

    public void setCdeSancion(boolean cdeSancion) {
        this.cdeSancion = cdeSancion;
    }

    public Date getCde_fechaFinSancion() {
        return cde_fechaFinSancion;
    }

    public void setCde_fechaFinSancion(Date cde_fechaFinSancion) {
        this.cde_fechaFinSancion = cde_fechaFinSancion;
    }

    public Date getCde_fechaIniSancion() {
        return cde_fechaIniSancion;
    }

    public void setCde_fechaIniSancion(Date cde_fechaIniSancion) {
        this.cde_fechaIniSancion = cde_fechaIniSancion;
    }

        public String getPerteneceLiga(){

        String perteneceLiga;
        if(cdeLiga==true){
            perteneceLiga = "Si";
        }else{
            perteneceLiga = "No";
        }
        return perteneceLiga;
    }

    public String getEstaSancionado(){

        String sancionado;
        if(cdeSancion==true){
            sancionado = "Si";
        }else{
            sancionado = "No";
        }
        return sancionado;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdeCodigo != null ? cdeCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ColegiadoDeporte)) {
            return false;
        }
        ColegiadoDeporte other = (ColegiadoDeporte) object;
        if ((this.cdeCodigo == null && other.cdeCodigo != null) || (this.cdeCodigo != null && !this.cdeCodigo.equals(other.cdeCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.colegiatura.be.ColegiadoDeporte[cdeCodigo=" + cdeCodigo + "]";
    }



}
